package Chapter8;

import javax.swing.*;
import java.awt.*;

//175页程序8.10修改版 使用静态方法
public class BoxLayoutDemo2 {
    private JFrame frame;
    public Box pv,ph;

    public static void main(String[] args) {
        BoxLayoutDemo2 that = new BoxLayoutDemo2();
        that.go();
    }
    void go(){

        frame=new JFrame("BoxLayout测试程序2");
        Container contentPane=frame.getContentPane();
        pv=Box.createVerticalBox();
        pv.add(new JLabel("第一个"));
        pv.add(new JLabel("第二个"));
        pv.add(new JLabel("第三个"));
        contentPane.add(pv,BorderLayout.CENTER);

        ph=Box.createHorizontalBox();
        ph.add(new JButton("yes"));
        ph.add(new JButton("no"));
        ph.add(new JButton("cancel"));
        contentPane.add(ph,BorderLayout.SOUTH);
        frame.pack();
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
